package org.tp8.sampleapp.service;

import java.io.Serializable;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.tp8.sampleapp.exc.SampleAppException;
import org.tp8.sampleapp.model.AbstractModel;

/**
 * The Interface BaseEntityService.
 * 
 * @param <K>
 *            the key type
 * @param <T>
 *            the generic type
 */
public interface BaseEntityService<K extends Serializable, T extends AbstractModel<K>>
		extends BaseService {

	/**
	 * Save.
	 * 
	 * @param t
	 *            the t
	 * @return the t
	 * @throws SampleAppException
	 *             the sample app exception
	 */
	public T save(T t) throws SampleAppException;

	/**
	 * Find one.
	 * 
	 * @param id
	 *            the id
	 * @return the t
	 * @throws SampleAppException
	 *             the sample app exception
	 */
	public T findOne(K id) throws SampleAppException;

	/**
	 * Find by example.
	 * 
	 * @param pageable
	 *            the pageable
	 * @param t
	 *            the t
	 * @return the page
	 * @throws SampleAppException
	 *             the sample app exception
	 */
	public Page<T> findByExample(Pageable pageable, T t)
			throws SampleAppException;

	/**
	 * Delete.
	 * 
	 * @param id
	 *            the id
	 * @throws SampleAppException
	 *             the sample app exception
	 */
	public void delete(K id) throws SampleAppException;

}
